curdir := $(shell pwd)
src := $(wildcard $(curdir)/*.s)
obj := $(patsubst %.s, %.o, $(notdir $(src)))
target := led.bin

$(target):$(src)
	echo $(src) $(obj) $(target)
	arm-linux-gnueabihf-gcc -g -c led.s -o led.o
	arm-linux-gnueabihf-ld -Ttext 0X87800000 led.o -o led.elf
	arm-linux-gnueabihf-objdump -D led.elf > led.dis
	arm-linux-gnueabihf-objcopy -O binary -S -g led.elf led.bin

.PHONY:clean
clean:
	-rm -rf *.o *.bin *.dis *.elf 
